<template>
  <div class="con1">
    <div class="title">
      <div @click="tab(index)"
           v-for="(item, index) in items"
           :class="{ sta: index === curId }"
           :key="index">
        {{ item }}
      </div>
    </div>
    <div class="input">
      <div class="ipo">
        <img src="@/assets/img/login/ipo.png"
             alt="" />
        <input type="text"
               placeholder="请输入手机号"
               v-model="phone" />
      </div>
      <div class="ipo">
        <img src="@/assets/img/login/bass.png"
             alt="" />
        <input type="password"
               placeholder="请输入密码"
               v-model="pass" />
      </div>

      <div class="qie"
           v-show="curId == 0">
        <div></div>
        <div>
          <span class="zhuche"
                @click="change(0)">忘记密码</span>
          <span> | </span>
          <span class="zhuche"
                @click="change(1)">账号注册</span>
        </div>
      </div>
      <div class="qie"
           v-show="curId == 1">
        <div></div>
        <div>
          <span class="zhuche"
                @click="change(0)">忘记密码</span>
          <span> | </span>
          <span class="zhuche"
                @click="change(2)">企业注册</span>
        </div>
      </div>
      <div class="qie"
           v-show="curId == 2">
        <div></div>
        <div>
          <span class="zhuche"
                @click="change(0)">忘记密码</span>
          <span> | </span>
          <span class="zhuche"
                @click="change(3)">商家入驻申请</span>
        </div>
      </div>
    </div>
    <div class="input"
         v-show="curId == 2">
    </div>
    <div class="di">
      <div class="denglu"
           @click="denglu">登录</div>
      <div class="ru">
        <!-- <span></span>
        <span class="color1" @click="change(0)">忘记密码</span> -->
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      items: ["个人登录", "企业登录", "商家登录"],
      curId: 0, //切换身份登录
      show: true, //显示倒计时
      show1: true, //切换验证码手机登录
      count: "", //倒计时时间
      timer: null, //倒计时事件
      phone: '',
      pass: ''
    };
  },
  methods: {
    //tab切换
    tab(index) {
      this.curId = index;
      this.show = true;
      this.phone = ''
      this.pass = ''
      clearInterval(this.timer);
      this.timer = null;
    },
    denglu() {
      if (this.phone == '') {
        this.$message.error('请输入手机号')
      } else if (this.pass == '') {
        this.$message.error('请输入密码')
      } else {
        this.$postRequest('/api/user/memberUser/login', {
          phone: this.phone,
          password: this.pass
        }).then(res => {
          localStorage.setItem('userId', res.data.id)
          localStorage.setItem('level', '' + res.data.level)
          var params = this.$route.params
          if (params.name) {
            this.$router.push({ name: params.name, params: params, query: this.$route.query })
          } else {
            this.$router.push({ name: 'index' })
          }
        })
      }
    },
    //个人注册
    change(a) {
      if (a == 1) {
        this.$router.push({
          path: "/login/IndividualUser" //跳转的路径
        });
      } else if (a == 2) {
        this.$router.push({
          path: "/login/enterpriseUser" //跳转的路径
        });
      } else if (a == 0) {
        this.$router.push({
          path: "/login/forget" //跳转的路径
        });
      } else if (a == 3) {
        this.$router.push({
          path: "/settlein" //跳转的路径
        });
      }
    }
  }
};
</script>
<style scoped lang="scss">
.con1 {
  height: 100%;
  width: 100%;
  display: flex;
  flex-flow: column nowrap;
  justify-content: center;
  align-items: center;
  overflow-y: scroll;
  .title {
    flex-shrink: 0;
    width: 70%;
    display: flex;
    justify-content: space-around;
    height: 32px;
    align-items: center;
    margin-bottom: 120px;
    div {
      font-size: 24px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #666666;
      cursor: pointer;
    }
    .sta {
      font-size: 32px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #1a69e0;
    }
  }
  .input {
    flex-shrink: 0;
    width: 70%;
    margin-bottom: 30px;
    .ipo {
      height: 105px;
      width: 100%;
      display: flex;
      align-items: center;
      position: relative;
      img {
        width: 25px;
        height: 25px;
        position: absolute;
        top: 50%;
        transform: translate(0, -50%);
        left: 20px;
      }
      input {
        width: 100%;
        height: 100%;
        border: none;
        border-bottom: 1px solid #e5e5e5;
        outline: none;
        padding-left: 76px;
        font-size: 24px;
        font-family: PingFang SC;
        font-weight: 500;
        color: #1b1b1b;
        box-sizing: border-box;
        &:focus {
          border: none;
          border-bottom: 1px solid #1a69e0;
        }
        &::-webkit-input-placeholder {
          color: #bfbfbf;
        }
      }
    }
    .yanzheng {
      height: 105px;
      width: 100%;
      display: flex;
      align-items: center;
      position: relative;
      input {
        width: 100%;
        height: 100%;
        border: none;
        border-bottom: 1px solid #e5e5e5;
        outline: none;
        padding-left: 20px;
        font-size: 24px;
        font-family: PingFang SC;
        font-weight: 500;
        color: #1b1b1b;
        box-sizing: border-box;
        &:focus {
          border: none;
          border-bottom: 1px solid #1a69e0;
        }
        &::-webkit-input-placeholder {
          color: #bfbfbf;
        }
      }
      .daoji {
        width: 200px;
        height: 50px;
        background: rgba(26, 105, 224, 0.05);
        border: 1px solid #1a69e0;
        position: absolute;
        top: 50%;
        transform: translate(0, -50%);
        right: 0px;
        text-align: center;
        line-height: 50px;
        font-size: 24px;
        font-family: PingFang SC;
        font-weight: 500;
        color: #1a69e0;
        cursor: pointer;
      }
    }
    .qie {
      width: 100%;
      height: 60px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 18px;
      font-family: PingFang SC;
      color: #010101;
      .yanzeng {
        cursor: pointer;
      }
      .zhuche {
        color: #0655ce;
        cursor: pointer;
      }
    }
  }
  .di {
    flex-shrink: 0;
    text-align: center;
    margin-bottom: 50px;
    .denglu {
      width: 400px;
      height: 60px;
      background: #1a69e0;
      border-radius: 2px;
      line-height: 60px;
      text-align: center;
      font-size: 24px;
      font-family: PingFang SC;
      font-weight: 500;
      color: #ffffff;
      cursor: pointer;
    }
    .ru {
      font-size: 18px;
      font-family: PingFang SC;
      font-weight: 500;
      color: #000000;
      margin-top: 20px;
      .color1 {
        color: #0655ce;
        cursor: pointer;
      }
    }
  }
}
</style>